﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Pg.BioMedics.SDR.ServiceAgents.Configuration
{
    /// <summary>
    /// Represents single external service configuration within
    /// ServiceAgents block
    /// </summary>
    public sealed class ServiceElement : ConfigurationElement
    {
        #region Constants

        private const string ServiceNameProperty = "serviceName";
        private const string CredentialsProperty = "credentials";
        private const string EndpointsProperty = "endpoints";

        /// <summary>
        /// Service name for ASR service
        /// </summary>
        public const string ASRService = "ASR";

        #endregion

        #region Properties

        /// <summary>
        /// Gets / sets service name
        /// </summary>
        [ConfigurationProperty(ServiceNameProperty)]
        public string ServiceName
        {
            get
            {
                return this[ServiceNameProperty] as string;
            }

            set
            {
                this[ServiceNameProperty] = value;
            }
        }

        /// <summary>
        /// Gets / sets service credentials 
        /// </summary>
        [ConfigurationProperty(CredentialsProperty)]
        public ServiceCredentialsElement Credentials
        {
            get
            {
                return this[CredentialsProperty] as ServiceCredentialsElement;
            }

            set
            {
                this[CredentialsProperty] = value;
            }
        }

        /// <summary>
        /// Gets / sets collection of endpoints configuration
        /// </summary>
        [ConfigurationProperty(EndpointsProperty)]
        public EndpointsElementCollection Endpoints
        {
            get
            {
                return this[EndpointsProperty] as EndpointsElementCollection;
            }

            set
            {
                this[EndpointsProperty] = value;
            }
        }

        #endregion
    }
}
